<%@ page language="java" pageEncoding="UTF-8" %>
<%@ include file="../portal_common/taglibs.jsp" %>
<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=9; IE=8; IE=7; IE=EDGE">
    <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7"/>
    <title>重置密码</title>

    <link rel="stylesheet" type="text/css" href="${ctx}/css/webbase.css"/>
    <link rel="stylesheet" type="text/css" href="${ctx}/css/pages-register.css"/>
</head>

<body ng-app="pinyougou" ng-controller="userController">
<div class="register py-container ">clearfix footer
    <!--head-->
    <div class="logoArea">
        <a href="" class="logo"></a>
    </div>
    <!--register-->
    <div class="registerArea">
        <h3>重置密码</h3>
        <div class="info">
            <form class="sui-form form-horizontal">
                <div class="control-group">
                    <label class="control-label">用户名：</label>
                    <div class="controls">
                        <input id="username" type="text" placeholder="请输入你的用户名"
                               class="input-xfat input-xlarge">
                    </div>
                </div>
                <div class="control-group">
                    <label for="inputPassword" class="control-label">登录密码：</label>
                    <div class="controls">
                        <input id="password" type="password" placeholder="设置登录密码"
                               class="input-xfat input-xlarge">
                    </div>
                </div>
                <div class="control-group">
                    <label class="control-label">密保问题：</label>
                    <div class="controls">
                        <input id="question" type="text" placeholder="原始密保问题"
                               class="input-xfat input-xlarge">
                    </div>
                </div>
                <div class="control-group">
                    <label class="control-label">密保答案：</label>
                    <div class="controls">
                        <input id="answer" type="text" placeholder="原始密保答案"
                               class="input-xfat input-xlarge">
                    </div>
                </div>
                <div class="control-group">
                    <label class="control-label"></label>
                    <div class="controls btn-reg">
                        <a class="sui-btn btn-block btn-xlarge btn-danger" onclick="reset()">确认重置</a>
                    </div>
                </div>
            </form>
            <div class="clearfix"></div>
        </div>
    </div>
    <!--foot-->
    <div class="py-container copyright">
        <ul>
            <li>关于我们</li>
            <li>联系我们</li>
            <li>联系客服</li>
            <li>商家入驻</li>
            <li>营销中心</li>
            <li>手机瓷器商城</li>
            <li>销售联盟</li>
            <li>瓷器商城社区</li>
        </ul>
        <div class="address">
            地址：地球中国河北省大连市他旮旯村儿 邮编：100000 电话：400-400-4000 传真：010-11111111
        </div>
        <div class="beian">京ICP备--------号京公网安备ABCABCABC
        </div>
    </div>
</div>

<script>
    //判断是否为空
    function isBlank(value) {
        return !value || !/\S/.test(value)
    }

    function reset() {
        var username = $('#username').val();
        var password = $('#password').val();
        var question = $('#question').val();
        var answer = $('#answer').val();
        if (isBlank(username) || isBlank(password) || this.isBlank(question) || isBlank(answer)) {
            alert('请正确填写每一项');
            return;
        }
        if (password.length < 6) {
            alert('密码不可少于六位');
            return;
        }
        console.log(username);
        console.log(password);
        $.ajax({
                url: "${ctx}/forget/reset",
                type: 'post',
                data: {
                    'username': username,
                    'password': password,
                    'question': question,
                    'answer': answer
                },
                dataType: 'json',
                // contentType: 'application/json',
                success: function (response) {
                    console.log(response);
                    if (response.success) {
                        alert(response.message);
                        window.location.href = '${ctx}/authentication/require';
                    } else {
                        alert(response.message);
                    }
                }
            }
        );
    }

    //个人查询
    /*  $("#personNext").click(function () {
          console.log("个人查询");
          var name = $(".name").val();
          var idCard = $(".idCard").val();
          var flag = true;
          if (name && idCard) {
              if (flag) {
                  $('.idCard_errorMsg').css({display: "none"});
                  $('.name_errorMsg').css({display: "none"});
                  $.ajax({
                          url: " /verify/report/issue",
                        type: 'post',
                        data: {
                            'storageNo': dataResult.storageNo,
                            'name': name,
                            'code': idCard,
                            'userType': 1,
                            'busType': dataResult.busType
                        },
                        dataType: 'json',
                        success: function (result) {
                            if (!result.success) {
                                $('.idCard_errorMsg').text(result.message);
                                $('.idCard_errorMsg').css({display: "block"});
                            } else {
                                dataResult = result.data;
                                barseUrl = dataResult.fileBase;
                                delete dataResult.fileBase;
                                console.log(dataResult);
                                //查询结果显示
                                //当前查询内容页面隐藏,获取证书按钮隐藏
                                $(".checkIdentify,#getCertificate").css({display: "none"});
                                $(".selectedCon").css({display: "block"});
                                success2(true)
                            }
                        }
                    }
                );
            } else {
                alert("获取失败")
            }
        } else {
            if (!name) {
                $('.name_errorMsg').css({display: "block"})
            } else {
                $('.name_errorMsg').css({display: "none"})
            }
            if (!idCard) {
                $('.idCard_errorMsg').css({display: "block"})
            } else {
                $('.idCard_errorMsg').css({display: "none"})
            }
        }
    });*/
</script>
<script type="text/javascript" src="${ctx}/js/plugins/jquery/jquery.min.js"></script>
<script type="text/javascript" src="${ctx}/js/plugins/jquery.easing/jquery.easing.min.js"></script>
<script type="text/javascript" src="${ctx}/js/plugins/sui/sui.min.js"></script>
<script type="text/javascript" src="${ctx}/js/plugins/jquery-placeholder/jquery.placeholder.min.js"></script>
<script type="text/javascript" src="${ctx}/js/pages/register.js"></script>
</body>

</html>